// 左一左边
$.get('http://127.0.0.1:5002/task1').done(function (data) {
    var myCharts = echarts.init(document.querySelector('.text .san'))
    console.log(data);
    option = {
        "title": {
            "text": "各省水果销量",
            x: "center",
            y: "0%",
            textStyle: {
                color: '#fff',
                fontSize: '12'
            },
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        grid: {
            top: '20%',
            right: '3%',
            left: '20%',
            bottom: '20%'
        },
        xAxis: [{
            type: 'category',
            data: data.name,
            axisLine: {
                lineStyle: {
                    color: 'rgba(255,255,255,0.12)'
                }
            },
            axisLabel: {
                margin: 10,
                color: '#e2e9ff',
                rotate: 30,
                textStyle: {
                    fontSize: 5
                },
            },
        }],
        yAxis: [{
            axisLabel: {
                formatter: function (value) {
                    return (value / 100000) + "万"
                },
                color: '#e2e9ff',
            },
            axisLine: {
                show: false,
                lineStyle: {
                    color: 'rgba(255,255,255,1)'
                }
            },
            splitLine: {
                lineStyle: {
                    color: 'rgba(255,255,255,0.5)'
                }
            }
        }],
        series: [{
            type: 'scatter',
            data: data.value,
            barWidth: '15px',
            itemStyle: {
                normal: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                        offset: 0,
                        color: 'rgba(0,244,255,1)' // 0% 处的颜色
                    }, {
                        offset: 1,
                        color: 'rgba(0,77,167,1)' // 100% 处的颜色
                    }], false),
                    barBorderRadius: [30, 30, 30, 30],
                    shadowColor: 'rgba(0,160,221,1)',
                    shadowBlur: 4,
                }
            }
        }]
    };
    myCharts.setOption(option)
});
// 左一右边
$.get('http://127.0.0.1:5002/task1').done(function (data) {
    var myChart = echarts.init(document.querySelector('.text .ci'))
    var newdata = []
    console.log(data.name.length);
    for (let i = 0; i < data.name.length; i++) {
        newdata.push({
            name: data.name[i],
            value: data.value[i]
        })

    }
    console.log(newdata)
    // let randcolor = () => {
    //     let r = 100 + ~~(Math.random() * 100);
    //     let g = 135 + ~~(Math.random() * 100);
    //     let b = 100 + ~~(Math.random() * 100);
    //     return `rgb(${r}, ${g}, ${b})`
    // }
    option = {
        title: {
            text: '全国水果销量',
            x: 'center',
            textStyle: {
                fontSize: 12,
                color: "#fff"
            }

        },

        tooltip: {
            show: true,
            formatter: params => {
                const { name, value } = params

                return `
                        平台：${name} <br/>
                        数量：${value}
                    `
            }
        },
        series: [{

            name: '全国水果销量',
            type: 'wordCloud',
            size: ['15%', '99%'],
            sizeRange: [6, 66],
            textRotation: [0, 45, 90, -45],
            rotationRange: [-45, 180],
            shape: 'circle',
            textPadding: 0,
            autoSize: {
                enable: true,
                minSize: 4
            },


            textStyle: {
                fontWeight: 700,
                opacity: .9,
                color: function () {
                    // Random color
                    return 'rgb(' + [
                        Math.round(Math.random() * 160),
                        Math.round(Math.random() * 160),
                        Math.round(Math.random() * 160)
                    ].join(',') + ')'
                }
            },
            emphasis: {
                shadowBlur: 10,
                shadowColor: '#333'
            },



            data: newdata
        }]
    };

    myChart.setOption(option);
})
// 左二：关系图
$.get('http://127.0.0.1:5002/task2').done(function (data) {
    var mychart = echarts.init(document.querySelector('.panel .guan'))
    console.log(data.link);
    var newdata = []
    var newlink = []
    var name = []

    for (let i = 0; i < data.data.length; i++) {
        newdata.push(
            {
                'name': data.data[i].name,
                'x': data.data[i].x,
                'y': data.data[i].y,
                "symbolSize": 40,
                // "value": 16,
                "symbol": "circle",
                "draggable": "true",

            }

        )
    }
    for (let i = 0; i < data.link.length; i++) {
        newlink.push(
            {
                'source': data.link[i].source,
                'target': data.link[i].target,
                'color': function () {
                    // Random color
                    return 'rgb(' + [
                        Math.round(Math.random() * 160),
                        Math.round(Math.random() * 160),
                        Math.round(Math.random() * 160)
                    ].join(',') + ')'
                }
            }
        )

    }
    console.log(newlink);
    var option = {
        tooltip: {
            formatter: '{b}'
        },
        animationDuration: 1000,
        animationEasingUpdate: 'quinticInOut',
        edgeSymbol: ['arrow'],
        edgeSymbolSize: [4, 10],
        edgeLabel: {
            normal: {
                textStyle: {
                    fontSize: 20
                }
            }
        },
        series: [{
            //name: '', //用于tooltip的显示
            type: 'graph',
            layout: 'none',
            data: newdata,
            links: newlink,
            // categories: name,
            roam: true,
            label: {
                normal: {
                    show: true,
                    // position: [8, 10], //inside
                    formatter: '{b}',
                    fontSize: 12,
                    // fontStyle: '100',
                    color: "#ccc"
                }
            },
            // height: 3,
            lineStyle: {
                normal: {
                    width: 3,
                    type: "linear",
                    color: function () {
                        // Random color
                        return 'rgb(' + [
                            Math.round(Math.random() * 160),
                            Math.round(Math.random() * 160),
                            Math.round(Math.random() * 160)
                        ].join(',') + ')'
                    },
                    curveness: 0.2,
                    type: "solid",
                    // edgeSymbol: ['arrow'],
                }
            }
        }]
    };
    mychart.setOption(option)
})
// 左三左边：大箱型图
$.get('http://127.0.0.1:5002/task3').done(function (data) {
    var myChart = echarts.init(document.querySelector('.text .da'))
    console.log(data.index);
    index = ['华冠超市', '华联生鲜超市', '大润发超级卖场', '家家福', '欧尚', '物美超市', '盒马鲜生', '苏宁易生鲜', '超市发']
    // 指定图表的配置项和数据
    var option = {
        grid: {
            width: 300,
            height: 140,
            bottom: 10,
            top: 20,
            left: 30,
            right: 30,
            // backgroundColor: 'rgb(43,60,120)'
        },
        // backgroundColor: 'rgb(43,60,120)',
        tooltip: {
            trigger: 'item',
            axisPointer: {
                type: 'shadow'
            }
        },
        xAxis: {
            type: 'category',
            data: data.index,
            // boundaryGap: true,
            // nameGap: 10,
            axisLabel: {
                show: true,
                color: "#ccc",
                rotate: 30,
                fontSize: 10,
                formatter: data.index
            },
            axisTick: {
                show: false
            },
            axisLine: {
                show: false
            }
        },
        yAxis: {
            type: 'value',
            axisTick: {
                show: false
            },
            axisLine: {
                show: false
            },
            splitLine: {
                show: false
            }
        },
        series: [
            {
                name: '箱线图',
                type: 'boxplot',
                data: data.value,
                label: {
                    show: false
                },
                backgroundColor: 'rgb(43,60,120)',
                itemStyle: {
                    normal: {
                        borderColor: {
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 0,
                            y2: 1,
                            colorStops: [{
                                offset: 0,
                                color: '#F02FC2' // 0% 处的颜色
                            }, {
                                offset: 1,
                                color: '#3EACE5' // 100% 处的颜色
                            }],
                            globalCoord: false // 缺省为 false
                        },
                        borderWidth: 2,
                        color: {
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 0,
                            y2: 1,
                            colorStops: [{
                                offset: 0,
                                color: 'rgba(240,47,194,0.7)'  // 0% 处的颜色
                            }, {
                                offset: 1,
                                color: 'rgba(62,172,299,0.7)' // 100% 处的颜色
                            }],
                            globalCoord: false // 缺省为 false
                        },
                    }
                },
            }
        ]
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);

})
// 左三右边：箱型图
$.get('http://127.0.0.1:5002/task3').done(function (data) {
    var myChart = echarts.init(document.querySelector('.text .xiao'))
    console.log(data);
    var xiao = []
    xiao.push(
        {
            name: data.index[0],
            value: data.value[0]
        }
    )
    console.log(xiao);

    // 指定图表的配置项和数据
    var option = {
        grid: {
            width: 120,
            height: 145,
            bottom: 10,
            top: 20,
            left: 40,
            right: 10,
            // backgroundColor: 'rgb(43,60,120)'
        },
        // backgroundColor: 'rgb(43,60,120)',
        tooltip: {
            trigger: 'item',
            axisPointer: {
                type: 'shadow'
            }
        },
        xAxis: {
            type: 'category',
            data: ['华冠超市'],
            nameTextStyle: {
                color: '#3259B8',
                fontSize: 12,

            },
            axisLabel: {
                show: true,
                color: "#ccc",
                fontSize: 15
            },
            axisTick: {
                show: false
            },
            axisLine: {
                show: false
            }
        },
        yAxis: {
            type: 'value',
            axisTick: {
                show: false
            },
            axisLine: {
                show: false
            },
            splitLine: {
                show: false
            }
        },
        series: [
            {
                name: '箱线图',
                type: 'boxplot',
                data: data.value[0],
                label: {
                    show: false
                },
                backgroundColor: 'rgb(43,60,120)',
                itemStyle: {
                    normal: {
                        borderColor: {
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 0,
                            y2: 1,
                            colorStops: [{
                                offset: 0,
                                color: '#F02FC2' // 0% 处的颜色
                            }, {
                                offset: 1,
                                color: '#3EACE5' // 100% 处的颜色
                            }],
                            globalCoord: false // 缺省为 false
                        },
                        borderWidth: 12,
                        color: {
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 0,
                            y2: 1,
                            colorStops: [{
                                offset: 0,
                                color: 'rgba(240,47,194,0.7)'  // 0% 处的颜色
                            }, {
                                offset: 1,
                                color: 'rgba(62,172,299,0.7)' // 100% 处的颜色
                            }],
                            globalCoord: false // 缺省为 false
                        },
                    }
                },
            }
        ]
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);

})
// 右一左边
$.get('http://127.0.0.1:5002/task7').done(function (data) {
    var myChart = echarts.init(document.querySelector('.text .qi'))
    console.log(data["销量"]);

    var option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        grid: {
            top: '20%',
            right: '3%',
            left: '15%',
            bottom: '25%',
            // width: "px",
            height: "120px"
        },
        title: {
            text: "各省水果分科销量",
            left: "center",
            y: "0%",
            textStyle: {
                color: '#fff',
                fontSize: '12'
            },
        },
        xAxis: {
            type: "category",
            data: data["产品分类"],
            axisLine: {
                lineStyle: {
                    color: 'rgba(255,255,255,0.12)'
                }
            },
            axisLabel: {
                show: true,
                margin: 10,
                color: '#e2e9ff',
                rotate: 30,
                textStyle: {
                    fontSize: 12
                },
            },
        },
        yAxis: {
            type: "value",
            axisLabel: {
                formatter: function (value) {
                    return (value / 10000000) + "万"
                },
                color: '#e2e9ff',
                fontSize: '7px'
            },
            axisLine: {
                show: false,
                lineStyle: {
                    color: 'rgba(255,255,255,1)'
                }
            },
            splitLine: {
                lineStyle: {
                    color: 'rgba(255,255,255,0.5)'
                }
            }
        },
        series: [
            {
                data: data["销量"],
                type: "scatter",
                symbolSize: function (data) {
                    return Math.sqrt(data) / 800;
                },
                emphasis: {
                    focus: 'series',
                    label: {
                        show: true,
                        formatter: function (param) {
                            return param.data;
                        },
                        position: 'top'
                    }
                },
                itemStyle: {
                    shadowBlur: 10,
                    shadowColor: 'rgba(23,176,150, 0.8)',
                    shadowOffsetY: 5,
                    color: new echarts.graphic.RadialGradient(0.4, 0.3, 1, [
                        {
                            offset: 0,
                            color: 'rgb(23, 176, 150)'
                        },
                        {
                            offset: 1,
                            color: 'rgb(28, 210, 168)'
                        }
                    ])
                }
            }
        ]
    }
    myChart.setOption(option)
});
// 右一右边
$.get('http://127.0.0.1:5002/task7').done(function (data) {
    var myChart = echarts.init(document.querySelector('.text .zhu'))
    // console.log(data["产品分类"]);
    var ydata = data["销量"]
    var ydata1 = []
    for (let i = 0; i < data["销量"].length; i++) {
        ydata1.push(parseInt(ydata[i] / 1000000))

    }
    ydata1.sort(function (a, b) {
        return b - a;
    })
    console.log(ydata1);
    // 绘制左侧面
    const CubeLeft = echarts.graphic.extendShape({
        shape: {
            x: 0,
            y: 0
        },
        buildPath: function (ctx, shape) {
            const xAxisPoint = shape.xAxisPoint
            const c0 = [shape.x, shape.y]
            const c1 = [shape.x - 10, shape.y - 3]
            const c2 = [xAxisPoint[0] - 10, xAxisPoint[1] - 3]
            const c3 = [xAxisPoint[0], xAxisPoint[1]]
            ctx.moveTo(c0[0], c0[1]).lineTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).closePath()
        }
    })
    const CubeRight = echarts.graphic.extendShape({
        shape: {
            x: 0,
            y: 0
        },
        buildPath: function (ctx, shape) {
            const xAxisPoint = shape.xAxisPoint
            const c1 = [shape.x, shape.y]
            const c2 = [xAxisPoint[0], xAxisPoint[1]]
            const c3 = [xAxisPoint[0] + 5, xAxisPoint[1] - 3]
            const c4 = [shape.x + 8, shape.y - 3]
            ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath()
        }
    })
    const CubeTop = echarts.graphic.extendShape({
        shape: {
            x: 0,
            y: 0
        },
        buildPath: function (ctx, shape) {
            // 逆时针 角 y 负数向上  X 负数向左
            const c1 = [shape.x, shape.y]
            const c2 = [shape.x + 5, shape.y - 3]
            const c3 = [shape.x - 16, shape.y - 5]
            const c4 = [shape.x - 10, shape.y - 4]
            ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath()
        }
    })
    echarts.graphic.registerShape('CubeLeft', CubeLeft)
    echarts.graphic.registerShape('CubeRight', CubeRight)
    echarts.graphic.registerShape('CubeTop', CubeTop)
    var option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        grid: {
            top: '25%',
            right: '3%',
            left: '15%',
            bottom: '25%',
            // width: "210px",
            height: "120px"
        },
        title: {
            text: "全国水果分科销量",
            left: "center",
            y: "-1",
            textStyle: {
                color: '#fff',
                fontSize: '12'
            },
        },
        xAxis: {
            type: "category",
            data: data["产品分类"],
            axisLine: {
                show: false,
                lineStyle: {
                    color: 'rgba(255,255,255,0.12)'
                }
            },
            axisLabel: {
                show: true,
                margin: 10,
                color: '#e2e9ff',
                rotate: 30,
                textStyle: {
                    fontSize: 6
                },
            },
            axisTick: {
                show: false
            }
        },
        yAxis: {
            name: "销售额/(万元)",
            type: "value",
            axisLabel: {
                formatter: function (value) {
                    return value
                },
                color: '#e2e9ff',
                fontSize: '10px',
            },
            splitLine: {
                show: true,
                lineStyle: {
                    type: 'dashed',
                    opacity: .3
                }
            },
            axisLine: {
                show: false,
                lineStyle: {
                    color: 'rgba(255,255,255,1)'
                }
            },
        },
        series: [
            {
                type: 'custom',
                renderItem: (params, api) => {
                    const location = api.coord([api.value(0), api.value(1)])
                    return {
                        type: 'group',
                        children: [{
                            type: 'CubeLeft',
                            shape: {
                                api,
                                xValue: api.value(0),
                                yValue: api.value(1),
                                x: location[0],
                                y: location[1],
                                xAxisPoint: api.coord([api.value(0), 0])
                            },
                            style: {
                                fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                    offset: 0,
                                    color: 'rgb(132,112,255)'
                                },
                                {
                                    offset: 1,
                                    color: 'rgb(132,112,255)'
                                }
                                ])
                            }
                        }, {
                            type: 'CubeRight',
                            shape: {
                                api,
                                xValue: api.value(0),
                                yValue: api.value(1),
                                x: location[0],
                                y: location[1],
                                xAxisPoint: api.coord([api.value(0), 0])
                            },
                            style: {
                                fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                    offset: 0,
                                    color: 'rgb(126,192,238)'
                                },
                                {
                                    offset: 1,
                                    color: 'rgb(126,192,238)'
                                }
                                ])
                            }
                        }, {
                            type: 'CubeTop',
                            shape: {
                                api,
                                xValue: api.value(0),
                                yValue: api.value(1),
                                x: location[0],
                                y: location[1],
                                xAxisPoint: api.coord([api.value(0), 0])
                            },
                            style: {
                                fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                    offset: 0,
                                    color: 'rgb(132,112,255)'
                                },
                                {
                                    offset: 1,
                                    color: 'rgb(132,112,255)'
                                }
                                ])
                            }
                        }]
                    }
                },
                data: ydata1
            },
            {
                data: ydata1,
                type: "bar",
                label: {
                    normal: {
                        show: true,
                        position: 'top',
                        textStyle: {
                            fontSize: 10,
                            color: 'purple'
                        },

                        formatter: '{c}',
                    }
                },
                itemStyle: {
                    color: 'transparent'
                },
                tooltip: {

                },
            }

        ]
    }
    myChart.setOption(option)
});

// 右二
$.get('http://127.0.0.1:5002/task8').done(function (data) {
    var myChart = echarts.init(document.querySelector('.panel .pie'))
    var datas = []
    datas.push(
        {
            value: data.total,
            name: "total"
        },
        {
            value: data.value,
            name: "value"
        }
    )
    console.log(data);
    // 求属于value的那一部分的百分号
    var bai = ((data.total + data.value) / data.value).toFixed(2)
    console.log(bai);
    var option = {
        title: {
            text: data.name,
            x: 'center',
            top: '50',
            textStyle: {

                fontWeight: 'normal',
                color: '#fff',
                fontSize: '30'
            },
            subtext: data.value + '\n' + bai + "%",
            subtextStyle: {
                fontSize: 20,
                fontWeight: 700,
                color: 'rgb(82,110,196)'
            }
        },
        color: ['#fff', 'rgb(84,112,198)'],
        tooltip: {
            formatter: '{b}: {c} ({d}%)'
        },
        series: [

            {
                name: data.name,
                type: 'pie',
                data: datas,
                radius: ['80%', '100%'],
                // radius: ['50%', '66%'],
                itemStyle: {
                    borderRadius: 4,
                    borderColor: '#fff',
                    borderWidth: 0,
                },
                hoverAnimation: false,
                label: {
                    show: false,
                    position: 'inside',
                    formatter: '{b}: {c} ({d}%)' // 这里的格式化字符串就是显示的内容
                },
            }
        ]
    }
    console.log(option.tooltip);
    myChart.setOption(option)
});
// 右三
$.get('http://127.0.0.1:5002/task9').done(function (data) {
    var myChart = echarts.init(document.querySelector('.panel .line'))
    console.log(data);
    var option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                label: {
                    backgroundColor: '#6a7985'
                }
            }
        },
        grid: {
            top: '10%',
            right: '10%',
            left: '10%',
            bottom: '10%',
            containLabel: true,
            // width: 400,
            height: 180,
        },
        xAxis: {
            // name: "月份",
            type: "category",
            data: data.name,
            axisLabel: {
                formatter: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
                rotate: 30,
                color: "#fff"
            },
            axisTick: {
                show: false // 不显示坐标轴刻度线
            },
            // axisLine: {
            //     show: false, // 不显示坐标轴线
            // },
            //   axisLabel: {
            //         show: false, // 不显示坐标轴上的文字
            //   }
        },
        yAxis: {
            type: "value",

            splitLine: {
                show: true,
                lineStyle: {
                    type: 'dashed',
                    opacity: .8
                }
            },
            axisLine: {
                show: false
            },
            axisLabel: {
                show: false
            },
        },
        series: [
            {
                name: "每月增加会员人数",
                data: data.value,
                type: "line",
                smooth: true,
                symbolSize: 10,
                lineStyle: {

                    normal: {
                        width: 6,
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: 'rgba(0,244,255,1)' // 0% 处的颜色
                        }, {
                            offset: 1,
                            color: 'rgba(0,77,167,1)' // 100% 处的颜色
                        }], false),
                    }
                },
                label: {
                    show: true,
                    position: 'top',
                    textStyle: {
                        fontSize: 12,

                    },
                    borderColor: '#fff',
                    borderWidth: 12,
                    borderType: "solid",
                    borderRadius: 0.5,

                }
            }
        ]

    }
    myChart.setOption(option)
});

//中间
$.get('http://127.0.0.1:5002/task6').done(function (data) {
    var myChart = echarts.init(document.querySelector('.map .c_map'))
    value1 = []
    value2 = []
    city = []
    for (let i = 0; i < data['销量'].length; i++) {
        value1.push(data["销量"][i].value)
        value2.push(data["门店平均销量"][i].value)
        city.push(data["销量"][i].name)
    }
    var newdata = [
        {
            sale: '销量',
            value: value1
        },
        {
            sale: '门店平均销量',
            value: value2
        }
    ]
    option = {
        tooltip: {
            show: true,
            formatter: function (params) {
                if (params.value) {
                    return '&nbsp;&nbsp;' + params.name + '&nbsp;&nbsp;&nbsp;' + params.value + '元&nbsp;&nbsp;';
                } else {
                    return '&nbsp;&nbsp;' + params.name + '0元&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
                }
            }
        },
        visualMap: {
            min: 0,
            max: 100,
            itemWidth: 10,
            itemHeight: 89,
            left: '20',
            bottom: '10',
            text: ['高', '低'],
            textStyle: {
                color: 'white',
                fontSize: 12,
            },
            inRange: {
                color: ['#D9EEFF', '#2F9BFF']
            },
            outOfRange: {
                show: false,
            }
        },

        geo: {
            map: 'china',
            show: true,
            roam: false,
            label: {
                emphasis: {
                    show: false
                }
            },
            itemStyle: {
                normal: {
                    show: false
                }
            }
        },
        series: [
            {
                type: 'map',
                map: 'china',
                aspectScale: 0.75,
                //zoom:1.1,
                label: {
                    normal: {
                        formatter: function (para) {
                            return '{name|' + para.name + '}'
                        },
                        rich: {
                            cnNum: {
                                fontSize: 11,
                                color: '#333333',
                                align: 'center',
                            },
                            name: {
                                fontSize: 11,
                                color: 'white',
                                align: 'center',
                                lineHeight: 20,
                            },
                        },
                        //formatter: '{b}',
                        color: '#333333',
                        show: true
                    },
                    emphasis: {
                        show: false,
                    }
                },
                itemStyle: {
                    normal: {
                        areaColor: '#D9EEFF',
                        borderColor: 'rgb(22,143,226)',
                        borderWidth: 1,
                    },
                    emphasis: {
                        areaColor: '#FFAE00',
                    }
                },
                data: data['销量']
            },
            {
                type: 'map',
                map: 'china',
                aspectScale: 0.75,
                //zoom:1.1,
                label: {
                    normal: {
                        formatter: function (para) {
                            return '{name|' + para.name + '}'
                        },
                        rich: {
                            cnNum: {
                                fontSize: 11,
                                color: '#333333',
                                align: 'center',
                            },
                            name: {
                                fontSize: 11,
                                color: '#333333',
                                align: 'center',
                                lineHeight: 20,
                            },
                        },
                        //formatter: '{b}',
                        color: '#333333',
                        show: true
                    },
                    emphasis: {
                        show: false,
                    }
                },
                itemStyle: {
                    normal: {
                        areaColor: '#D9EEFF',
                        borderColor: '#fff',
                        borderWidth: 1,
                    },
                    emphasis: {
                        areaColor: '#FFAE00',
                    }
                },
                data: data['门店平均销量']
            }
        ]
    };
    $(".map .map1").on("click", "a", function () {
        // console.log($(this).index());
        // 点击a之后根据当前的索引号找到相关的对象
        var obj = newdata[$(this).index() - 1]
        for (let i = 0; i < value1.length; i++) {
            option.series[0].data[i].value = obj.value
            // option.series[1].data = obj.value[1]
        }
        myChart.setOption(option)
    })
    myChart.setOption(option)
})




